package org.zoomdev.zoom.aop.factory.impl;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public abstract class BaseSingleMethodFactory<T, E> {

    private final Map<E, T> map = new ConcurrentHashMap<>();

    public T create(E param) {
        return map.computeIfAbsent(param, k -> createImpl(param));
    }

    protected abstract T createImpl(E param);
}
